const Controller = require('egg').Controller;

class SmsController extends Controller {

    async send () {
        const {ctx} = this;
        console.log('sen sms');

        let mobile = ctx.request.body.mobile;
        let info = ctx.request.body.info;
        // let signName = ctx.request.body.signName || '香草科技';
        // let templateCode = ctx.request.body.templateCode || 'SMS_148613689';

        console.log(mobile);

        try{
            const r = await ctx.service.sms.send({mobile, info});

            // console.log('返回');
            // console.log(r);
        }catch(err){
            console.log('异常');
            console.log(err);
        }

        ctx.helper.success('1234');
    }

    async info () {
        const { ctx } = this;
        
        const { order_code } = ctx.request.body;

        const result = await ctx.service.sms.info(order_code);

        ctx.helper.success(result);
    }

    
}
module.exports = SmsController;